package v1

import (
	"encoding/json"
	"geek-cloud-native/chapter04-0925/global"
	"github.com/julienschmidt/httprouter"
	"net/http"
)

type User struct {
}

func NewUser() *User {
	return &User{}
}

// List 查看用户列表
// @Summary 获取多个用户
// @Produce json
// @Tags 用户管理
// @Router /api/v1/users [get]
func (u *User) List(writer http.ResponseWriter, request *http.Request, params httprouter.Params) {
	response := map[string]interface{}{
		"status": http.StatusOK,
		"msg":    "用户列表",
	}
	resStr, _ := json.Marshal(response)
	global.Logger.Info(string(resStr))
	_, err := writer.Write(resStr)
	if err != nil {
		global.Logger.Info("user.writer.Write err: ", err)
		return
	}
	//global.Logger.Info("获取用户列表成功")
}
